package com.woniuxy.exam.service.impl;
import com.google.common.collect.Lists;

import com.woniuxy.exam.dto.OrdersDto;
import com.woniuxy.exam.entity.Movies;
import com.woniuxy.exam.entity.Orders;
import com.woniuxy.exam.mapper.MoviesMapper;
import com.woniuxy.exam.mapper.OrdersMapper;
import com.woniuxy.exam.service.IOrdersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Lzj
 * @since 2023-10-31
 */
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements IOrdersService {

    @Autowired
    private OrdersMapper ordersMapper;

    @Autowired
    private MoviesMapper moviesMapper;
    @Override
    public double calculateTotalPrice(int userId, int movieId, int quantity) {
        double price = moviesMapper.getMoviePrice(movieId);// 获取电影价格
        double totalPrice = price* quantity;
        return totalPrice; //
    }

    @Override
    public List<OrdersDto> findAll() {
       return ordersMapper.findAllOrder();
    }

    @Override
    public List<OrdersDto> queryALL() {
        List<OrdersDto> list = baseMapper.queryALL();
        return list;
    }
}
